Android Games Practical Programming By Example: Quickstart 1 by Yang Fred

Android Games Practical Programming By Example: Quickstart 1 by Yang Fred

Author:Yang, Fred [Yang, Fred]
Language: eng
Format: epub
Publisher: Fred Yang
Published: 2014-05-01T21:00:00+00:00


int d = this.direction;

int [] destination=null;

switch(d){

case DIR_DOWN:

destination = new int[]{col,row+1};

break;

case DIR_LEFT:

destination = new int[]{col-1,row};

break;

case DIR_RIGHT:

destination = new int[]{col+1,row};

break;

case DIR_UP:

destination = new int[]{col,row-1};

break;

}

this.dx = destination[0]*TILE_SIZE;

this.dy = destination[1]*TILE_SIZE+TILE_SIZE-SPRITE_HEIGHT;

col = destination[0];

row = destination[1];

new Thread(){

public void run(){

int mv = MOVE_SPAN_M;

isLocked = true; //non-alert mode

for(int i=0;i<TILE_SIZE/mv;i++){

if(dx>x) x += mv;

else if(dx<x) x -= mv;

if(dy>y) y += mv;

else if(dy<y) y -= mv;

if(currSegment != direction) currSegment = direction;



Download



Copyright Disclaimer:
This site does not store any files on its server. We only index and link to content provided by other sites. Please contact the content providers to delete copyright contents if any and email us, we'll remove relevant links or contents immediately.